package com.school.generator.base;

import java.beans.ConstructorProperties;

public class PageInfo {
    private Integer pageNo;
    private Integer pageSize;
    private Integer totalNum;
    private Integer totalPage;
    private Object data;

    public PageInfo(PageableEntity page, Integer totalNum, Object data) {
        this.pageNo = page.getPageNo();
        this.pageSize = page.getPageSize();
        this.totalNum = totalNum;
        this.totalPage = this.totalNum / this.pageSize;
        if (this.totalNum % this.pageSize > 0) {
            Integer var5 = this.totalPage;
            Integer var6 = this.totalPage = this.totalPage + 1;
        }

        this.data = data;
    }

    public PageInfo(Object data) {
        this.pageNo = 0;
        this.pageSize = 0;
        this.totalNum = 0;
        this.totalPage = 0;
        this.data = data;
    }

    public Integer getPageNo() {
        return this.pageNo;
    }

    public Integer getPageSize() {
        return this.pageSize;
    }

    public Integer getTotalNum() {
        return this.totalNum;
    }

    public Integer getTotalPage() {
        return this.totalPage;
    }

    public Object getData() {
        return this.data;
    }

    public PageInfo setPageNo(Integer pageNo) {
        this.pageNo = pageNo;
        return this;
    }

    public PageInfo setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
        return this;
    }

    public PageInfo setTotalNum(Integer totalNum) {
        this.totalNum = totalNum;
        return this;
    }

    public PageInfo setTotalPage(Integer totalPage) {
        this.totalPage = totalPage;
        return this;
    }

    public PageInfo setData(Object data) {
        this.data = data;
        return this;
    }

    @Override
    public boolean equals(Object o) {
        if (o == this) {
            return true;
        } else if (!(o instanceof PageInfo)) {
            return false;
        } else {
            PageInfo other = (PageInfo)o;
            if (!other.canEqual(this)) {
                return false;
            } else {
                label71: {
                    Object this$pageNo = this.getPageNo();
                    Object other$pageNo = other.getPageNo();
                    if (this$pageNo == null) {
                        if (other$pageNo == null) {
                            break label71;
                        }
                    } else if (this$pageNo.equals(other$pageNo)) {
                        break label71;
                    }

                    return false;
                }

                Object this$pageSize = this.getPageSize();
                Object other$pageSize = other.getPageSize();
                if (this$pageSize == null) {
                    if (other$pageSize != null) {
                        return false;
                    }
                } else if (!this$pageSize.equals(other$pageSize)) {
                    return false;
                }

                label57: {
                    Object this$totalNum = this.getTotalNum();
                    Object other$totalNum = other.getTotalNum();
                    if (this$totalNum == null) {
                        if (other$totalNum == null) {
                            break label57;
                        }
                    } else if (this$totalNum.equals(other$totalNum)) {
                        break label57;
                    }

                    return false;
                }

                Object this$totalPage = this.getTotalPage();
                Object other$totalPage = other.getTotalPage();
                if (this$totalPage == null) {
                    if (other$totalPage != null) {
                        return false;
                    }
                } else if (!this$totalPage.equals(other$totalPage)) {
                    return false;
                }

                Object this$data = this.getData();
                Object other$data = other.getData();
                if (this$data == null) {
                    if (other$data == null) {
                        return true;
                    }
                } else if (this$data.equals(other$data)) {
                    return true;
                }

                return false;
            }
        }
    }

    protected boolean canEqual(Object other) {
        return other instanceof PageInfo;
    }

    @Override
    public int hashCode() {
        int result = 1;
        Object $pageNo = this.getPageNo();
        result = result * 59 + ($pageNo == null ? 43 : $pageNo.hashCode());
        Object $pageSize = this.getPageSize();
        result = result * 59 + ($pageSize == null ? 43 : $pageSize.hashCode());
        Object $totalNum = this.getTotalNum();
        result = result * 59 + ($totalNum == null ? 43 : $totalNum.hashCode());
        Object $totalPage = this.getTotalPage();
        result = result * 59 + ($totalPage == null ? 43 : $totalPage.hashCode());
        Object $data = this.getData();
        result = result * 59 + ($data == null ? 43 : $data.hashCode());
        return result;
    }

    @Override
    public String toString() {
        return "PageInfo(pageNo=" + this.getPageNo() + ", pageSize=" + this.getPageSize() + ", totalNum=" + this.getTotalNum() + ", totalPage=" + this.getTotalPage() + ", data=" + this.getData() + ")";
    }

    public PageInfo() {
    }

    @ConstructorProperties({"pageNo", "pageSize", "totalNum", "totalPage", "data"})
    public PageInfo(Integer pageNo, Integer pageSize, Integer totalNum, Integer totalPage, Object data) {
        this.pageNo = pageNo;
        this.pageSize = pageSize;
        this.totalNum = totalNum;
        this.totalPage = totalPage;
        this.data = data;
    }
}
